package com.mls.guardian.executor.master;

import com.mls.guardian.container.MasterContainer;
import com.mls.guardian.protocol.RemoteBody;
import com.mls.guardian.protocol.RemoteCommand;
import com.mls.guardian.protocol.body.LogMessageBody;
import com.mls.guardian.remoting.executor.RemoteExecutor;
import io.netty.channel.ChannelHandlerContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by jl on 15/11/11.
 */
public class SlaveLogExecutor implements RemoteExecutor {
    private static final Logger log = LoggerFactory.getLogger(SlaveLogExecutor.class);
    private MasterContainer container;

    public SlaveLogExecutor(MasterContainer container) {
        this.container = container;
    }
    @Override
    public RemoteBody execute(ChannelHandlerContext ctx, RemoteCommand request) throws Exception {
        LogMessageBody logMessageBody = new LogMessageBody();
        log.info("收到客户端的log 内容是{}",((LogMessageBody)request.getRemoteBody()).getLog());
        return logMessageBody;
    }
}
